Skip to content

docs(tokens): correct the note claiming gateway max_output is unenforced#109

Merged
VickyXAI merged 2 commits into
mainfrom
fix/correct-maxoutput-comment
Jul 20, 2026
Merged

docs(tokens): correct the note claiming gateway max_output is unenforced#109
VickyXAI merged 2 commits into
mainfrom
fix/correct-maxoutput-comment

Conversation

@VickyXAI

Copy link
Copy Markdown
Contributor

Follow-up to #108. Comment-only, no behavior change.

The note I added in 3.35.2 said the gateway's max_output values are "not enforced: Franklin sends max_tokens 16384 to haiku today and the gateway accepts it."

Accepting the request and honoring it are different things. The gateway clamps with Math.min(request.max_tokens, model.maxOutput) on both the messages and chat/completions handlers, and derives its price quote from the clamped ceiling. The request is accepted rather than rejected, so the clamp stays invisible until a reply is long enough to hit it — the smoke test that produced my claim returned ten tokens, nowhere near either ceiling.

The rule the comment supports is unchanged and still correct: static tables stay authoritative, because the gateway's values are wrong for models we already know. Only the stated reason was wrong — and a wrong reason is how a right rule gets reverted by the next person who checks it.

Gateway-side fix for the underlying wrong values: BlockRunAI/blockrun#266.

Local suite 634 pass.

1bcMax added 2 commits July 20, 2026 17:24
The comment added in 3.35.2 said the gateway's max_output values are 'not
enforced: Franklin sends max_tokens 16384 to haiku today and the gateway
accepts it.' Accepting the request and honoring it are different things. The
gateway clamps with Math.min(request.max_tokens, model.maxOutput) on both
handlers and prices the quote off the clamped ceiling — the request is
accepted rather than rejected, so the clamp stays invisible until a reply is
long enough to hit it. The smoke test that produced that claim returned ten
tokens.

The conclusion the comment supports is unchanged: the static tables stay
authoritative, because the gateway's values are wrong for models we know.
Only the reasoning was wrong, and a wrong reason is how a right rule gets
reverted later.
Two things the first pass got imprecise, in a comment whose entire job is
precision about this mechanism:

- It cited 8192 / 64000 in the present tense. Those exact values are being
  corrected upstream (BlockRunAI/blockrun#266), so the comment was written
  pre-stale. Reframed as a dated observation, with the durable point stated
  separately: the catalog can be wrong, and a wrong value here is not
  cosmetic.
- It called the clamp 'invisible' without qualification. The handler does
  log 'capping to <limit>' — server-side, where no caller sees it
  (chat/completions/route.ts:1343). Invisible from here, not silent
  everywhere. Someone who finds that warn should not conclude the comment
  is wrong again.
@VickyXAI
VickyXAI merged commit 7ecb2b4 into main Jul 20, 2026
2 checks passed
@VickyXAI
VickyXAI deleted the fix/correct-maxoutput-comment branch July 20, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant